package com.huayousoft.demo.order.controller;

import com.huayousoft.demo.order.entity.Order;
import com.huayousoft.demo.order.feign.GoodsFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZhangHua
 * @date 2020/11/19 17:54
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private GoodsFeignClient goodsFeignClient;

    @GetMapping("/get/{id}")
    public Order get(@PathVariable Long id) {
        Order order = new Order();
        order.setId(id);
        order.setOrderName("订单名称" + id);
        order.setGoodsList(goodsFeignClient.list());
        return order;
    }
}
